package com.haima.sage.bigdata.api.entity;

import com.haima.sage.bigdata.api.entity.storage.Storage;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "t_compute_result")
public class ComputeResult {
    @Id
    private String id;
    @Column(nullable = false)
    private String name;
    @Column(nullable = false)
    private String tableName;
    @Column(nullable = true)
    private String tablePattern;
    @ManyToOne(optional = false)
    @JoinColumn(name="storage_id")
    private Storage storage;


    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(
            name = "t_compute_result_app_system",
            joinColumns = @JoinColumn(name = "result_id", referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "sys_id", referencedColumnName = "id"))
    private List<AppSystem> systems;

    public Storage getStorage() {
        return storage;
    }

    public void setStorage(Storage storage) {
        this.storage = storage;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public List<AppSystem> getSystems() {
        return systems;
    }

    public void setSystems(List<AppSystem> systems) {
        this.systems = systems;
    }

    public String getTablePattern() {
        return tablePattern;
    }

    public void setTablePattern(String tablePattern) {
        this.tablePattern = tablePattern;
    }
}
